$OpenBSD: patch-configure_in,v 1.3 2009/12/14 00:02:17 jakemsr Exp $
--- configure.in.orig	Fri Apr  6 06:23:11 2007
+++ configure.in	Wed Dec  9 22:06:10 2009
@@ -120,7 +120,7 @@ AC_DEFUN([AC_CHECK_LIBFLAC],
 
     ])
   if test "x$have_libFLAC" = "xyes"; then
-      LIBFLAC="-lFLAC"
+      LIBFLAC="-lFLAC -lm"
       AC_DEFINE(HAVE_LIBFLAC, 1,
         [Define if you have libFLAC 1.1.1 or 1.1.2])
   fi
@@ -136,11 +136,11 @@ AC_DEFUN([AC_CHECK_LIBFLAC113],
   KDE_CHECK_HEADER(FLAC/metadata.h,
   [
      KDE_CHECK_LIB(FLAC,FLAC__stream_decoder_seek_absolute,
-	          have_libFLAC=yes,,[-lFLAC -logg])
+	          have_libFLAC=yes,,[-lFLAC -logg -lm])
 
     ])
   if test "x$have_libFLAC" = "xyes"; then
-      LIBFLAC="-lFLAC -logg"
+      LIBFLAC="-lFLAC -logg -lm"
       AC_DEFINE(HAVE_LIBFLAC113, 1,
         [Define if you have libFLAC 1.1.3])
   fi
@@ -156,11 +156,11 @@ AC_DEFUN([AC_CHECK_LIBOGGFLAC],
   KDE_CHECK_HEADER(OggFLAC/seekable_stream_decoder.h,
   [
      KDE_CHECK_LIB(OggFLAC,OggFLAC__seekable_stream_decoder_process_single,
-	          have_libOggFLAC=yes,,[-lm -lOggFLAC -lFLAC])
+	          have_libOggFLAC=yes,,[-lOggFLAC -lFLAC -logg -lm])
 
     ])
   if test "x$have_libOggFLAC" = "xyes"; then
-      LIBOGGFLAC="-lOggFLAC"
+      LIBOGGFLAC="-lOggFLAC -lFLAC -logg -lm"
       AC_DEFINE(HAVE_LIBOGGFLAC, 1,
         [Define if you have libOggFLAC (required for loading OggFLAC files)])
   fi
@@ -179,13 +179,13 @@ AC_DEFUN([KDE_CHECK_OGGVORBIS],
     [:], [have_oggvorbis=no])
 
   KDE_CHECK_LIB(vorbis, vorbis_info_init,
-    [:], [have_oggvorbis=no], -logg)
+    [:], [have_oggvorbis=no], -logg -lm)
 
   KDE_CHECK_LIB(vorbisfile, ov_open,
-    [:], [have_oggvorbis=no], -lvorbis -logg)
+    [:], [have_oggvorbis=no], -lvorbis -logg -lm)
 
   if test "x$have_oggvorbis" = xyes; then
-    VORBIS_LIBS="-lvorbis -logg"
+    VORBIS_LIBS="-lvorbis -logg -lm"
     VORBISFILE_LIBS="-lvorbisfile"
 
     # for akode/plugins/xiph_decoder/
@@ -228,6 +228,15 @@ AC_DEFUN([KDE_CHECK_SUN],
   AC_CHECK_HEADERS([sys/audioio.h], [have_sun=yes])
 ])
 
+AC_DEFUN([KDE_CHECK_SNDIO],
+[
+  have_sndio=no
+
+  AC_CHECK_HEADERS([sndio.h], [have_sndio=yes])
+  AC_CHECK_LIB(sndio, sio_open, [LIBSNDIO="-lsndio"])
+  AC_SUBST(LIBSNDIO)
+])
+
 AC_DEFUN([KDE_CHECK_ALSA],
 [
   PKG_CHECK_MODULES([ALSA], [alsa >= 0.9], [have_alsa=yes], [have_alsa=no])
@@ -257,8 +266,8 @@ kde_save_akode_libs="$LIBS"
 LIBS="$all_libraries $USER_LDFLAGS"
 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
 AC_TRY_COMPILE([
-                #include <speex.h>
-                #include <speex_callbacks.h>
+                #include <speex/speex.h>
+                #include <speex/speex_callbacks.h>
                 #include <ogg/ogg.h>
                 ],[
                 ],[
@@ -267,7 +276,7 @@ AC_TRY_COMPILE([
 AC_MSG_RESULT($have_libspeex)
 if test x$have_libspeex = xyes; then
    KDE_CHECK_LIB(speex,speex_decoder_ctl,,
-                have_libspeex=no,[-lspeex -logg])
+                have_libspeex=no,[-lspeex -logg -lm])
 fi
 CFLAGS="$kde_save_akode_cflags"
 LIBS="$kde_save_akode_libs"
@@ -278,10 +287,10 @@ kde_save_akode_libs="$LIBS"
 LIBS="$all_libraries $USER_LDFLAGS"
 CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
 AC_TRY_COMPILE([
-                #include <speex.h>
-                #include <speex_callbacks.h>
-                #include <speex_echo.h>
-                #include <speex_preprocess.h>
+                #include <speex/speex.h>
+                #include <speex/speex_callbacks.h>
+                #include <speex/speex_echo.h>
+                #include <speex/speex_preprocess.h>
                 #include <ogg/ogg.h>
                 ],[
                 ],[
@@ -290,12 +299,12 @@ AC_TRY_COMPILE([
 AC_MSG_RESULT($have_libspeex11)
 if test x$have_libspeex11 = xyes; then
    KDE_CHECK_LIB(speex,speex_decode_int,,
-                broken_libspeex11=yes,[-lspeex -logg])
+                broken_libspeex11=yes,[-lspeex -logg -lm])
 fi
 
 if test x$have_libspeex = xyes; then
    AC_DEFINE(HAVE_SPEEX,1,[Define if you have speex installed])
-   SPEEXLIBS="-lspeex -logg"
+   SPEEXLIBS="-lspeex -logg -lm"
 fi
 CFLAGS="$kde_save_akode_cflags"
 LIBS="$kde_save_akode_libs"
@@ -548,6 +557,19 @@ if test "x$with_sun" != xno; then
   fi
 fi
 
+AC_ARG_WITH(sndio,
+  [AS_HELP_STRING(--with-sndio,
+    [enable support for sndio output @<:@default=check@:>@])],
+  [], with_sndio=check)
+
+if test "x$with_sndio" != xno; then
+  KDE_CHECK_SNDIO
+
+  if test "x$with_sndio" != xcheck && test "x$have_sndio" != xyes; then
+    AC_MSG_FAILURE([--with-sndio was given, but test for sndio failed])
+  fi
+fi
+
 AC_ARG_WITH(alsa,
   [AS_HELP_STRING(--with-alsa,
     [enable support for ALSA output @<:@default=check@:>@])],
@@ -586,6 +608,7 @@ AM_CONDITIONAL(include_src_resampler, test x$have_libs
 AM_CONDITIONAL(include_alsa_sink, test x$have_alsa = xyes)
 AM_CONDITIONAL(include_oss_sink, test x$have_oss = xyes)
 AM_CONDITIONAL(include_sun_sink, test x$have_sun = xyes)
+AM_CONDITIONAL(include_sndio_sink, test x$have_sndio = xyes)
 AM_CONDITIONAL(include_jack_sink, test x$have_jack = xyes)
 AM_CONDITIONAL(include_polyp_sink, test x$have_polyp = xyes)
 AM_CONDITIONAL(include_ffmpeg_decoder, test x$have_ffmpeg = xyes)
@@ -623,6 +646,7 @@ AC_CONFIG_FILES([ akode/plugins/oss_sink/Makefile ])
 AC_CONFIG_FILES([ akode/plugins/polyp_sink/Makefile ])
 AC_CONFIG_FILES([ akode/plugins/src_resampler/Makefile ])
 AC_CONFIG_FILES([ akode/plugins/sun_sink/Makefile ])
+AC_CONFIG_FILES([ akode/plugins/sndio_sink/Makefile ])
 AC_CONFIG_FILES([ akode/plugins/xiph_decoder/Makefile ])
 AC_CONFIG_FILES([ akode/akode-config ])
 AC_OUTPUT
